package com.expert.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.expert.common.page.MyPage;
import com.expert.entity.Feature;
import com.expert.layui.LayuiDataGridResult;
import com.expert.mapper.FeatureMapper;
import com.expert.service.FeatureService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mankind
 * @since 2018-05-31
 */
@Service
public class FeatureServiceImpl extends ServiceImpl<FeatureMapper, Feature> implements FeatureService {


    @Override
    public LayuiDataGridResult selectListByPage(Page<Feature> page) {
        LayuiDataGridResult result=new LayuiDataGridResult();
        List<Feature> featureList=baseMapper.selectPage(
                page, new EntityWrapper<Feature>()
        );
        if(featureList!=null){
            result.setCount((long)page.getTotal());
            result.setData(featureList);
        }
        return result;
    }

    @Override
    public MyPage list(MyPage<Feature> page) {
        List<Feature> groups = baseMapper.list(page);
        page.setRecords(groups);
        return page;

    }


}
